#ifndef AWAITER_H
#define AWAITER_H

#include <typeinfo>
#include <memory>
#include "ccoroutine_core_global.h"

namespace CCoroutine{
class PromiseBase;

class AwaiterBase{
public:
    virtual ~AwaiterBase(){};
    virtual bool ready() = 0;
    virtual void suspend(PromiseBase* p) = 0;
    virtual void resume() = 0;
};
class SuspendNever:public AwaiterBase{
public:
    bool ready(){return true;}
    void suspend(PromiseBase* p){};
    void resume(){}
};

class SuspendAlways:public AwaiterBase{
public:
    bool ready(){return false;}
    void suspend(PromiseBase* p){};
    void resume(){}
};
}

inline CCoroutine::AwaiterBase* getAwaiter(CCoroutine::AwaiterBase* a){
    return a;
}
#endif

